#pragma once

#include "WMarkBuffer.h"
#include "BufferQueue.h"
#include <utils/Thread.h>
#include "Barrier.h"
#include "WatermarkManager.h"

namespace android {

class WatermarkManager;

class DispatcherThread: public Thread {
public:
    DispatcherThread(WatermarkManager* manager, BufferQueue<WMarkBuffer>* queue);
    ~DispatcherThread();
    void start();
    void stop();
    void onDataReady();

private:
    virtual bool threadLoop() override;

    BufferQueue<WMarkBuffer>* mBufferQueue;
    WatermarkManager* mManager;

    mutable Barrier mBarrier;
};

}//namespace
